package geovis.springcloud.demo.stream.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;


@Component
@EnableBinding(OutputInterface.class)
public class StreamService {

    @Autowired
    @Qualifier(OutputInterface.OUTPUT1)
    MessageChannel channel1;

    public void sendMessageToChannel1(String message){
        String content = "send message to channel1 : "+message;

        channel1.send(MessageBuilder.withPayload(content).build());

    }
}
